/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.mensageiro.control;

import br.com.mensageiro.visual.Principal;
import java.io.InputStream;
import java.util.Scanner;

/**
 *
 * @author Danilo Dorotheu
 */
public class Recebedor implements Runnable{
    private InputStream servidor;
    private Principal principal;
	
    public Recebedor(InputStream servidor, Principal principal)
    {
            this.servidor = servidor;
            this.principal = principal;
    }

    public void run() {
        @SuppressWarnings("resource")
        Scanner s = new Scanner(this.servidor);
        
        while(s.hasNextLine())
        {
            principal.jtxMsgRecebida.append(s.nextLine());
            principal.jtxMsgRecebida.append("\n");
        }
    }
}
